<?php

class DbConnection extends CDbConnection
{
    private $_ft_transaction;

	public function __construct($dsn='', $username='', $password='')
	{
		parent::__construct($dsn, $username, $password);
	}

	public function createCommand($query=null)
	{
		$this->setActive(true);
		return new DbCommand($this,$query);
	}

    public function getCurrentTransaction()
    {
        if($this->_ft_transaction!==null)
        {
            if($this->_ft_transaction->getActive())
                return $this->_ft_transaction;
        }
        return null;
    }

	public function beginTransaction()
	{
        $this->setActive(true);
        $this->getPdoInstance()->beginTransaction();
        return $this->_ft_transaction=new DbTransaction($this);
	}
}
